<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:if test="${type=='CLIENT'}">
	<c:set var="pageTitle" value="客户" />
	<c:if test="${id==null || id==''}"><c:set var="pageTopTitle" value="新增客户" /></c:if>
	<c:if test="${id!=null && id!=''}"><c:set var="pageTopTitle" value="编辑客户" /></c:if>
	<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';BASE_CLIE;')==-1 && fn:indexOf(currentUser.privs,';BUSI_CLIE;')==-1}">
		<c:set var="disabledStr" value="disabled='true'" />
	</c:if>
</c:if>
<c:if test="${type=='PROVIDER'}">
	<c:set var="pageTitle" value="供应商" />
	<c:if test="${id==null || id==''}"><c:set var="pageTopTitle" value="新增供应商" /></c:if>
	<c:if test="${id!=null && id!=''}"><c:set var="pageTopTitle" value="编辑供应商" /></c:if>
	<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';BASE_PROV;')==-1 && fn:indexOf(currentUser.privs,';PURC_PROV;')==-1}">
		<c:set var="disabledStr" value="disabled='true'" />
	</c:if>
</c:if>
<c:if test="${type=='COOPERATOR'}">
	<c:set var="pageTitle" value="外协商" />
	<c:if test="${id==null || id==''}"><c:set var="pageTopTitle" value="新增外协商" /></c:if>
	<c:if test="${id!=null && id!=''}"><c:set var="pageTopTitle" value="编辑外协商" /></c:if>
	<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';BASE_COOP;')==-1 && fn:indexOf(currentUser.privs,';COOP_COOP;')==-1}">
		<c:set var="disabledStr" value="disabled='true'" />
	</c:if>
</c:if>
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doSave(flag){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		document.getElementById("continue_flag").value=flag;
		frm.submit();
	}
	function doCancel(){
		if(window.opener){
			window.close();
		}else{
			var doRefresh="${doRefresh}";
			if(doRefresh=="1"){
				parent.popRetVal="${command.establishment.id}";
			}
			parent.ClosePop();
		}
	}
	
	function elementOnChnage(){
		checkContactChange(this.getAttribute("index"));
	}
	
	var navArr=checkNavigator();
	function doContactAdd(){
		var tbl=document.getElementById("contactRowTbl");
		var contactNum=document.getElementById("contact_num").value-0;

		var tr=document.createElement("tr");
		tr.setAttribute("id","contactTr"+contactNum);
		
		var td;
		var input;

		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="48px";
		input.setAttribute("maxLength","15");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","contact_name_"+contactNum);
		input.setAttribute("id","contact_name_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("select");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","sex_"+contactNum);
		input.setAttribute("id","sex_"+contactNum);
		input.onchange=elementOnChnage;
		var opt1=document.createElement("option");
		opt1.setAttribute("value","男");
		if(navArr[0]!="msie"){
			opt1.innerText="男";
		}else{
			opt1.text="男";
			//opt1.setAttribute("text","男");
		}
		try{
			input.add(opt1,null);
		}catch(ex){
			input.add(opt1);//ie
		}
		var opt2=document.createElement("option");
		opt2.setAttribute("value","女");
		if(navArr[0]!="msie"){
			opt2.innerText="女";
		}else{
			opt2.text="女";
			//opt2.setAttribute("text","女");
		}
		try{
			input.add(opt2,null);
		}catch(ex){
			input.add(opt2);//ie
		}
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="48px";
		input.setAttribute("maxLength","15");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","possie_"+contactNum);
		input.setAttribute("id","possie_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="82px";
		input.setAttribute("maxLength","15");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","mobile_"+contactNum);
		input.setAttribute("id","mobile_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="114px";
		input.setAttribute("maxLength","50");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","email_"+contactNum);
		input.setAttribute("id","email_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="80px";
		input.setAttribute("maxLength","18");//NND,ie的setAttribute竟然对maxLength有区分大小写,晕倒
		input.setAttribute("index",contactNum);
		input.setAttribute("name","phone_"+contactNum);
		input.setAttribute("id","phone_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="80px";
		input.setAttribute("maxLength","25");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","im_"+contactNum);
		input.setAttribute("id","im_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","text");
		input.style.width="80px";
		input.setAttribute("maxLength","100");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","mark_"+contactNum);
		input.setAttribute("id","mark_"+contactNum);
		input.setAttribute("value","");
		input.setAttribute("className","TextBox");
		input.setAttribute("class","TextBox");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		input=document.createElement("input");
		input.setAttribute("type","checkbox");
		input.setAttribute("index",contactNum);
		input.setAttribute("name","is_main_"+contactNum);
		input.setAttribute("id","is_main_"+contactNum);
		input.setAttribute("value","1");
		input.onchange=elementOnChnage;
		td.appendChild(input);
		tr.appendChild(td);
		
		td=document.createElement("td");
		var link=document.createElement("a");
		link.setAttribute("href","javascript:doContactDelete("+contactNum+");");
		link.appendChild(document.createTextNode("删除"));
		td.appendChild(link);
		input=document.createElement("input");
		input.setAttribute("type","hidden");
		input.setAttribute("name","status_"+contactNum);
		input.setAttribute("id","status_"+contactNum);
		input.setAttribute("value","UNCHANGE");
		td.appendChild(input);
		input=document.createElement("input");
		input.setAttribute("type","hidden");
		input.setAttribute("name","id_"+contactNum);
		input.setAttribute("id","id_"+contactNum);
		input.setAttribute("value","0");
		td.appendChild(input);
		tr.appendChild(td);

		tbl.appendChild(tr);
		document.getElementById("contact_num").value=contactNum+1;
		
		resizePopwin();
	}
	function doContactDelete(index){
		ShowConfirm('确认框','确定删除吗？',340,80,"doContactDeleteAct("+index+")");
	}
	function doContactDeleteAct(index){
		if(popRetVal!=null){
			document.getElementById("contactTr"+index).style.display="none";
			document.getElementById("status_"+index).value="DELETE";
			
			resizePopwin();
		}
	}
	function doInit(){
		showFormErrorMsg();
		resizePopwin();
		document.getElementById("establishment.estName").focus();
	}
	function checkContactChange(index){
		if(document.getElementById("id_"+index).value=="" || document.getElementById("id_"+index).value=="0"){
			document.getElementById("status_"+index).value="NEW";
		}else{
			document.getElementById("status_"+index).value="EDIT";
		}
	}
	function doCheck(){
		var checkKey=encodeURIComponent(document.getElementById("establishment.estName").value.trim());
		if(checkKey!=""){
			var url="/base/EstablishmentCheck.ihtm?type=${type}&id=${command.establishment.id}&check_key="+checkKey;
			ShowIframe("名称检查",url,600,500);
		}
	}
	function selectManager(){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"selectManagerCallBack()");
	}
	function selectManagerCallBack(){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById("establishment.managerId").value=arr[0];
			document.getElementById("establishment.managerName").value=arr[1];
		}
	}
	
	function selectSuperior(){
		var url="/base/EstablishmentListForSelect.ihtm?type=CLIENT&show_all=Y";
		ShowIframe("选择上级",url,900,500,"selectSuperiorCallBack()");
	}
	function selectSuperiorCallBack(){
		if(popRetVal!=null){
			document.getElementById("establishment.superiorId").value=popRetVal[0];
			document.getElementById("superiorName").value=popRetVal[1];
		}
	}
	function clearSuperior(){
		document.getElementById("establishment.superiorId").value="0";
		document.getElementById("superiorName").value="";
	}
	function changeStatus(){
		if(document.getElementById("r_status1").checked){
			document.getElementById("establishment.status").value="Y";
		}else{
			document.getElementById("establishment.status").value="N";
		}
	}
	function changeBusiPphone(){
		if(document.getElementById("r_busi_pphone1").checked){
			document.getElementById("establishment.busiPphone").value="Y";
		}else{
			document.getElementById("establishment.busiPphone").value="N";
		}
	}
	function changeDeliPphone(){
		if(document.getElementById("r_deli_pphone1").checked){
			document.getElementById("establishment.deliPphone").value="Y";
		}else{
			document.getElementById("establishment.deliPphone").value="N";
		}
	}
	function changeMakePphone(){
		if(document.getElementById("r_make_pphone1").checked){
			document.getElementById("establishment.makePphone").value="Y";
		}else{
			document.getElementById("establishment.makePphone").value="N";
		}
	}
</script>
</head>
<body onload="doInit();" class="sheet modal-dialog" style="padding-top:10px;text-align:center;" >
<div class="sheet-main" id="bodyDiv" style="width:940px;margin:auto;text-align:left;">
<form name="frm" method="post"> 
  <div class="sheet-list" style="width:100%">
    <div class="modal-main search-business">
    	<div style="width:100%;">
					<%@ include file="../inc/PageTop.jsp"%>
					
					<div class="blank12"></div> 
					<fieldset class="det_fieldset "> <legend class="mag10">基本信息</legend>  	
	    			<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a2">
							<tr >
						      	<th><span class="MustInput">*</span>编号：</th>
						      	<spring:bind path="command.establishment.estCode">
						      	<td>
					      		<c:if test="${command.codeRule.generateRule!='MANUAL' && command.establishment.id==0}">
					      			<c:set var="codeDisabledStr" value="disabled" />
					      			<c:set var="classDisabledStr" value="class='TextBox readonly'" />
					      		</c:if>
					      		<c:if test="${command.codeRule.generateRule=='MANUAL' || command.establishment.id!=0}">
					      			<c:set var="codeDisabledStr" value="" />
					      			<c:set var="classDisabledStr" value="class='TextBox'" />
					      		</c:if>						      		
							    <input type="text" maxlength="15" onKeyUp="goNextInput('establishment.estName');" id="${status.expression}" name="${status.expression}" value="${status.value}" ${codeDisabledStr} ${classDisabledStr}>
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',1,'establishment.estCode');
						          </script>
								</td>
								</spring:bind>
						      	<th><span class="MustInput">*</span>名称：</th>
						     	<spring:bind path="command.establishment.estName">
						     	<td>
						     		<input type="text" class="TextBox" maxlength="50" onKeyUp="goNextInput('establishment.phone');" id="${status.expression}" name="${status.expression}" value="${status.value}">
									<img class="make-a" src="/images/make-c.gif" style="cursor:pointer;" onClick="doCheck('1');" ${disabledStr} title="查出哪些${pageTitle}是重名的，已删除的重名${pageTitle}可以在这里恢复">
							          <script language="javascript">
							          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',2,'establishment.estName');
							          </script>
						     	</td>
						     	</spring:bind>
								<th>经办人：</th>
						     	<td >
					     			<spring:bind path="command.establishment.managerName">
									<input  class="TextBox readonly" readOnly="true" type="text" id="${status.expression}" name="${status.expression}" value="${status.value}">
									<img class="make-a" src="/images/make-a.gif"   style="cursor:pointer;"  onClick="selectManager();" ${disabledStr}>
							          <script language="javascript">
							          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',3);
							          </script>
							      </spring:bind>
							      <spring:bind path="command.establishment.managerId">
									<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
								  </spring:bind>
						     	</td>
						    </tr>
						    <c:if test="${type=='CLIENT'}">
						    <tr >
						      	<th>类别：</th>
						     	<spring:bind path="command.establishment.estTypeId">
						     	<td >
						     		<select id="${status.expression}" name="${status.expression}">
										<option value="0">==请选择==</option>
										<c:forEach var="item" items="${estTypeList}">
										<option value="${item.id}" <c:if test="${status.value==item.id}">selected</c:if>>${item.typeName}</option>
										</c:forEach>
						  			</select>
							          <script language="javascript">
							          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',4,'establishment.estTypeId');
							          </script>
						     	</td>
						     	</spring:bind>
						      	<th >等级：</th>
						     	<spring:bind path="command.establishment.estLevelId">
						     	<td >
						     		<select id="${status.expression}" name="${status.expression}">
										<option value="0">==请选择==</option>
										<c:forEach var="item" items="${estLevelList}">
										<option value="${item.id}" <c:if test="${status.value==item.id}">selected</c:if>>${item.levelName}</option>
										</c:forEach>
						  			</select>
							          <script language="javascript">
							          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',5,'establishment.estLevelId');
							          </script>
						     	</td>
						     	</spring:bind>
						     	<th>信用额度：</th>
						     	<td >
				     			<spring:bind path="command.establishment.creditCost">
								<input class="TextBox" type="text" id="${status.expression}" name="${status.expression}" value="${status.value}">
								<c:if test="${status.errorCode=='typeMismatch'}">
								  <script language="javascript">
									setFormErrorMsg('信用额度只能输入整数',6);
						          </script>
						        </c:if>
								</spring:bind>
						     	</td>
						    </tr>
						    <tr >
						      	<th>上级单位：</th>
						      	<td  colspan="3">
							     	<spring:bind path="command.superiorName">
						    		<input type="text"  class="TextBox readonly" readOnly="true" id="${status.expression}" name="${status.expression}" value="${status.value}">
									<img class="make-a" src="/images/make-a.gif"   style="cursor:pointer;"  onClick="selectSuperior();" />
									<img class="make-a" src="/images/icon_del.gif"   style="cursor:pointer;"  onClick="clearSuperior();" />
									设定客户的上级单位或总部，方便业务查询统计
							          <script language="javascript">
							          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',7);
							          </script>
						    		</spring:bind>
						    		<spring:bind path="command.establishment.superiorId">
										<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
									</spring:bind>
								</td>
								<th>状态：</th>
						     	<td >
						     		<input type="radio" name="r_status" id="r_status1" onClick="changeStatus();" <c:if test="${command.establishment.status=='Y'}">checked</c:if>>正常
									<input type="radio" name="r_status" id="r_status2" onClick="changeStatus();" <c:if test="${command.establishment.status=='N'}">checked</c:if>>停用
						  			<spring:bind path="command.establishment.status">
						  			<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
						  			</spring:bind>
						     	</td>
						    </tr>
						    </c:if>
						    <c:if test="${type!='CLIENT'}">
						    <tr >
								<th>状态：</th>
						     	<td colspan="5">
						     		<input type="radio" name="r_status" id="r_status1" onClick="changeStatus();" <c:if test="${command.establishment.status=='Y'}">checked</c:if>>正常
									<input type="radio" name="r_status" id="r_status2" onClick="changeStatus();" <c:if test="${command.establishment.status=='N'}">checked</c:if>>停用
						  			<spring:bind path="command.establishment.status">
						  			<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
						  			</spring:bind>
						     	</td>
						    </tr>
						    </c:if>
					  </table>
				  </fieldset>
				  <div class="blank12"></div>
				  <fieldset class="det_fieldset "> <legend class="mag10">辅助信息</legend>
	    			<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a2">
								<tr>
							      	<th>电话：</th>
							     	<spring:bind path="command.establishment.phone">
							     	<td  >
							     		<input type="text"  class="TextBox"  maxlength="20" onKeyUp="goNextInput('establishment.fax');" id="${status.expression}" name="${status.expression}" value="${status.value}">
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',7,'establishment.phone');
								          </script>
							     	</td>
							     	</spring:bind>
							      	<th  >传真：</th>
							     	<spring:bind path="command.establishment.fax">
							     	<td  >
							     		<input type="text"  class="TextBox"  maxlength="20" onKeyUp="goNextInput('establishment.email');" id="${status.expression}" name="${status.expression}" value="${status.value}">
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',8,'establishment.fax');
								          </script>
							     	</td>
							     	</spring:bind>
							     	<th  >Email：</th>
							     	<spring:bind path="command.establishment.email">
							     	<td  >
							     		<input type="text"  class="TextBox"  maxlength="50" onKeyUp="goNextInput('establishment.webSite');" id="${status.expression}" name="${status.expression}" value="${status.value}">
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',9,'establishment.email');
								          </script>
							     	</td>
							     	</spring:bind>
							    </tr>
							    <tr >
							      	<th >网站地址：</th>
							     	<spring:bind path="command.establishment.webSite">
							     	<td >
							     		<input type="text"  class="TextBox"  maxlength="50" onKeyUp="goNextInput('establishment.postcode');" id="${status.expression}" name="${status.expression}" value="${status.value}">
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',10,'establishment.webSite');
								          </script>
							     	</td>
							     	</spring:bind>
							      	<th >地区：</th>
							     	<spring:bind path="command.establishment.areaId">
							     	<td >
							  			<select id="${status.expression}" name="${status.expression}" style="width:140px">
											<option value="0">==请选择==</option>
											<commonTag:createSelectTree list="${areaList}" emptyOption="0" justEnabled="1" defaultValue="${status.value}" />
										</select>
								        <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',11,'establishment.areaId');
								        </script>
							     	</td>
							     	</spring:bind>
							     	<th >邮编：</th>
							     	<spring:bind path="command.establishment.postcode">
							     	<td >
							     		<input type="text"  class="TextBox"  maxlength="10" onKeyUp="goNextInput('establishment.address');" id="${status.expression}" name="${status.expression}" value="${status.value}">
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',12,'establishment.postcode');
								          </script>
							     	</td>
							     	</spring:bind>
							    </tr>
							    <tr >
							      	<th >地址：</th>
							     	<spring:bind path="command.establishment.address">
							     	<td colspan="5">
							     		<input type="text" class="TextBox" maxlength="50" <c:if test="${type=='CLIENT'}">onKeyUp="goNextInput('establishment.mark');"</c:if><c:if test="${type=='PROVIDER' || type=='COOPERATOR'}">onKeyUp="goNextInput('establishment.bankName1');"</c:if> style="width:390px" id="${status.expression}" name="${status.expression}" value="${status.value}">
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',13,'establishment.address');
								          </script>
							     	</td>
							     	</spring:bind>
							    </tr>
									
						</table>
				  </fieldset>
				  <div class="blank12"></div>
				  <fieldset class="det_fieldset">
				  <legend class="mag10">联系人</legend>				  
					  <div class="table-list" style="padding:10px">
					  	  	<input type="hidden" name="contact_num" id="contact_num" value="${fn:length(command.contacts)}">
							<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center" id="contactTbl">
								<tbody id="contactRowTbl">
								<tr >
									<th  width="8%">姓名</th>
									<th  width="6%">性别</th>
									<th  width="8%">职务</th>
									<th  width="13%">手机</th>
									<th  width="16%">Email</th>
									<th  width="13%">电话</th>
									<th  width="13%">QQ</th>
									<th  width="13%">备注</th>
									<th  width="5%">主要</th>
									<th  width="5%">操作</th>
								</tr>
								<c:forEach var="item" items="${command.contacts}" varStatus="i">
								<tr id="contactTr${i.index}" <c:if test="${item.status=='DELETE'}">style="display:none"</c:if>>
									<td >
										<input type="text" style="width:48px" class="TextBox"  maxlength="15" id="contact_name_${i.index}" name="contact_name_${i.index}" value="${item.establishmentContact.contactName}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<select id="sex_${i.index}" name="sex_${i.index}" onChange="checkContactChange(${i.index});">
										   <option value="男" <c:if test="${item.establishmentContact.sex=='男'}">selected</c:if>>男</option>
										   <option value="女" <c:if test="${item.establishmentContact.sex=='女'}">selected</c:if>>女</option>
										</select>
									</td>
									<td >
										<input type="text" style="width:48px" class="TextBox"  maxlength="15" id="possie_${i.index}" name="possie_${i.index}" value="${item.establishmentContact.possie}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<input type="text" style="width:82px" class="TextBox"  maxlength="15" id="mobile_${i.index}" name="mobile_${i.index}" value="${item.establishmentContact.mobile}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<input type="text" style="width:114px" class="TextBox"  maxlength="50" id="email_${i.index}" name="email_${i.index}" value="${item.establishmentContact.email}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<input type="text" style="width:80px" class="TextBox"  maxlength="18" id="phone_${i.index}" name="phone_${i.index}" value="${item.establishmentContact.phone}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<input type="text" style="width:80px" class="TextBox"  maxlength="25" id="im_${i.index}" name="im_${i.index}" value="${item.establishmentContact.im}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<input type="text" style="width:80px" class="TextBox"  maxlength="100" id="mark_${i.index}" name="mark_${i.index}" value="${item.establishmentContact.mark}" onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<input type="checkbox" id="is_main_${i.index}" name="is_main_${i.index}" value="1" <c:if test="${item.establishmentContact.isMain=='Y'}">checked</c:if> onChange="checkContactChange(${i.index});">
									</td>
									<td >
										<a href="javascript:doContactDelete(${i.index});">删除</a>
										<input type="hidden" id="status_${i.index}" name="status_${i.index}" value="${item.status}">
										<input type="hidden" id="id_${i.index}" name="id_${i.index}" value="${item.oldId}">
									</td>
								</tr>
								</c:forEach>
								</tbody>
							</table>
							<div class="table-bot">
							  <a href="javascript:doContactAdd();">增加一行</a><span class="give">（说明：联系人设置为“主要”才能接收手机短信订阅发送的短信）</span>
						  	</div>
							<spring:bind path="command.contacts">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',14);
					          </script>
					     </spring:bind>				  	
					  </div>
				  </fieldset>
				  
				  <c:if test="${type=='PROVIDER' || type=='COOPERATOR'}">
				  <div class="blank12"></div>
				  <fieldset class="det_fieldset ">
				  	<legend class="mag10">银行资料</legend>
					<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a2">
						<tr>
					      	<th>开户银行1：</th>
					     	<spring:bind path="command.establishment.bankName1">
					     	<td  >
					     		<input type="text" class="TextBox" style="width:160px" maxlength="50" onKeyUp="goNextInput('establishment.bankAccCode1');" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',15,'establishment.bankName1');
						          </script>
					     	</td>
					     	</spring:bind>
					      	<th>银行帐号1：</th>
					     	<spring:bind path="command.establishment.bankAccCode1">
					     	<td  >
					     		<input type="text" class="TextBox" style="width:180px" maxlength="50" onKeyUp="goNextInput('establishment.bankAccName1');" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',16,'establishment.bankAccCode1');
						          </script>
					     	</td>
					     	</spring:bind>
					     	<th>开户名1：</th>
					     	<spring:bind path="command.establishment.bankAccName1">
					     	<td  >
					     		<input type="text" class="TextBox" style="width:160px" maxlength="25" onKeyUp="goNextInput('establishment.bankName2');" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',17,'establishment.bankAccName1');
						          </script>
					     	</td>
					     	</spring:bind>
					    </tr>
						<tr>
					      	<th>开户银行2：</th>
					     	<spring:bind path="command.establishment.bankName2">
					     	<td  >
					     		<input type="text" class="TextBox" style="width:160px" maxlength="50" onKeyUp="goNextInput('establishment.bankAccCode2');" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',18,'establishment.bankName2');
						          </script>
					     	</td>
					     	</spring:bind>
					      	<th>银行帐号2：</th>
					     	<spring:bind path="command.establishment.bankAccCode2">
					     	<td  >
					     		<input type="text" class="TextBox" style="width:180px" maxlength="50" onKeyUp="goNextInput('establishment.bankAccName2');" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',19,'establishment.bankAccCode2');
						          </script>
					     	</td>
					     	</spring:bind>
					     	<th>开户名2：</th>
					     	<spring:bind path="command.establishment.bankAccName2">
					     	<td  >
					     		<input type="text" class="TextBox" style="width:160px" maxlength="25" onKeyUp="goNextInput('establishment.mark');" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',20,'establishment.bankAccName2');
						          </script>
					     	</td>
					     	</spring:bind>
					    </tr>
				  </table>
				  </fieldset>
				  </c:if>
				  
				  <c:if test="${type=='CLIENT'}">
				  <div class="blank12"></div>
				  <fieldset class="det_fieldset ">
				  	<legend class="mag10">单据打印</legend>
						<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a2">
							<tr>
						      	<th>业务单打印：</th>
						     	<td>
						     		<input type="radio" name="r_busi_pphone" id="r_busi_pphone1" onClick="changeBusiPphone();" <c:if test="${command.establishment.busiPphone=='Y'}">checked</c:if>>显示（联系人、电话、地址）
									<br>
									<input type="radio" name="r_busi_pphone" id="r_busi_pphone2" onClick="changeBusiPphone();" <c:if test="${command.establishment.busiPphone=='N'}">checked</c:if>>隐藏（联系人、电话、地址）
						  			<spring:bind path="command.establishment.busiPphone">
						  			<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
						  			</spring:bind>
						     	</td>
						      	<th>送货单打印：</th>
						     	<td>
						     		<input type="radio" name="r_deli_pphone" id="r_deli_pphone1" onClick="changeDeliPphone();" <c:if test="${command.establishment.deliPphone=='Y'}">checked</c:if>>显示（联系人、电话、地址）
									<br>
									<input type="radio" name="r_deli_pphone" id="r_deli_pphone2" onClick="changeDeliPphone();" <c:if test="${command.establishment.deliPphone=='N'}">checked</c:if>>隐藏（联系人、电话、地址）
						  			<spring:bind path="command.establishment.deliPphone">
						  			<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
						  			</spring:bind>
						     	</td>
						     	<th>制作单打印：</th>
						     	<td>
						     		<input type="radio" name="r_make_pphone" id="r_make_pphone1" onClick="changeMakePphone();" <c:if test="${command.establishment.makePphone=='Y'}">checked</c:if>>显示（联系人、电话、地址）
									<br>
									<input type="radio" name="r_make_pphone" id="r_make_pphone2" onClick="changeMakePphone();" <c:if test="${command.establishment.makePphone=='N'}">checked</c:if>>隐藏（联系人、电话、地址）
						  			<spring:bind path="command.establishment.makePphone">
						  			<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
						  			</spring:bind>
						     	</td>
						    </tr>
				  		</table>
				  	</fieldset>
				  </c:if>
				  
				  <div class="blank12"></div>
				  <fieldset class="det_fieldset ">
				  <legend class="mag10">备注</legend>
				  	<div style="padding:10px;">
							<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">
								<tr >
									<spring:bind path="command.establishment.mark">
									<td >
										<textarea class="TextBox" style="width:660px;height:80px" id="${status.expression}" name="${status.expression}">${status.value}</textarea>
								          <script language="javascript">
								          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',21,'establishment.mark');
								          </script>
									</td>
									</spring:bind>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<div class="blank12">&nbsp;</div>
					<p class="give">
						<span>创建人：${command.establishment.createrName}</span>
						<span>创建时间：<c:if test="${command.establishment.createTime!=null}"><fmt:formatDate value="${command.establishment.createTime}" pattern="yyyy-MM-dd"/></c:if></span>
						<span>所属帐套：${command.tallySetName}</span>
						<spring:bind path="command.establishment.tallySetId">
				          <script language="javascript">
				          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',1);
				          </script>
						</spring:bind>
					</p>
				</div>
		</div>
	</div>
	<div class="modal-buttom" id="buttonDiv">
		<input type="button" class="buttom-a" value=" 保 存 " onClick="doSave('0');" ${disabledStr}>
		<input type="button" class="buttom-a" value="保存并新增" onClick="doSave('1');" ${disabledStr}>
		<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
		<input type="hidden" name="continue_flag" id="continue_flag" value="0">		
	</div>	
	<div class="modal-buttom" id="waitDiv" style="display:none">
		<span style="color:#ffffff">请稍候...</span>
	</div>
</form>
</div>
</body>
</html>
